package cn.zero.flowspringbootstater.mapper;

import cn.zero.flowspringbootstater.modular.entity.FlowEvents;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * <p>
 * 审批流程事件 Mapper 接口
 * </p>
 *
 * @author lei
 * @since 2022-06-17
 */
@Mapper
public interface FlowEventsMapper extends BaseMapper<FlowEvents> {

    /**
     * 根据业务id 和流程id查询审批事件数据
     * @param businessId:
     * @param flowId:
     * @return: java.util.List<cn.ygkj.system.entity.FlowEvents>
     * @author: lei
     */
    List<FlowEvents> selectByFowId2BusinessId(@Param("businessId") String businessId, @Param("flowId") Long flowId);
    /**
     * 根据业务id 和流程id修改流程事件的有效性(排除第一个)   1：有效  0：作废
     * @param businessId: 业务id
     * @param flowId: 流程号
     * @return: 修改的条数
     * @author: lei
     */
    int updateByFowId2BusinessId(@Param("businessId") String businessId, @Param("flowId") Long flowId, @Param("state") String state);

    /**
     * 修改节点之后的审批事件变为失效
     *
     * @return int
     * @author lei
     */

    int updateEventState(@Param("flowId") Long flowId, @Param("nodeId") Long nodeId);

}
